from BasePage import Action


# 操作层
class BxgLoginPages(Action):
    login_method = "com.boxuegu:id/other_login_btn"  # 登录方式: 其他方式登录
    login_type = "com.boxuegu:id/user_login_view"  # 登录类型: 账号登录
    login_method_2 = "com.boxuegu:id/passwordLoginTv"  # 再次更改登陆方式： 密码登陆
    account = "com.boxuegu:id/edit_usr"  # 账号
    password = "com.boxuegu:id/edit_pwd"  # 密码
    login_btn = "com.boxuegu:id/btn_login" # 登录按钮
    toast_xpath = "错误"

    def login_method_click(self):
        self.by_id_click(self.login_method)

    def login_type_click(self):
        self.by_id_click(self.login_type)

    def login_method_click_2(self):
        self.by_id_click(self.login_method_2)

    def account_send(self, value):
        self.by_id_send_keys(self.account, value)

    def pwd_send(self, value):
        self.by_id_send_keys(self.password, value)

    def login_btn_click(self):
        self.by_id_click(self.login_btn)

    def toast(self):
        return self.get_toast(self.toast_xpath)
